/*
 * @Author: szx
 * @Date: 2022-02-14 13:16:24
 * @LastEditTime: 2022-02-14 13:17:43
 * @Description:
 * @FilePath: \leetcode\1300-1399\1342\1342.js
 */
/**
 * @param {number} num
 * @return {number}
 */
var numberOfSteps = function (num) {
    let res = 0;
    while (num > 0) {
        if (num & (1 == 1)) num--;
        else num = Math.floor(num / 2);
        res++;
    }
    return res;
};
